#!/usr/bin/env python
import os, sys
import healpy as hp
import numpy as np
from cosat.slew import csst_slew
from argparse import ArgumentParser

def getSlewTime():
    parser = ArgumentParser()
    parser.add_argument('slew_angle', nargs='+', type=float,
        help='slew angle [just the rotation angle]')
    parser.add_argument('--slew_opt','-o', default=0, type=int,
        help='slew_opt: choose slew time constrains [default:0]')
    parser.add_argument('--interp_kind','-k', default='linear', type=str,
        help='interpolation method: linear or cubic [default: linear]')
    args = parser.parse_args()

    slew = csst_slew(slew_opt=args.slew_opt, kind=args.interp_kind)

    for i in range( len(args.slew_angle) ):
        slew_time = slew.getSlewTime(args.slew_angle[i])
        print('COSAT> slew time for angle {} is {:>.4f} seconds.'.format(args.slew_angle[i],slew_time))

    # return slew.getSlewTime(args.slew_angle)

def printSlewOpts():
    slew = csst_slew()
    slew.printSlewOpts()
